import Cookies from 'js-cookie'
import { TokenKey, UserKey, CurrentEnterprise, CurrentSite, EnterpriseList, SiteList } from '@/utils/const'
export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getEnterpriseList() {
  return Cookies.getJSON(EnterpriseList) || []
}

export function setEnterpriseList(enterpriseList) {
  return Cookies.set(EnterpriseList, enterpriseList)
}

export function removeEnterpriseList() {
  return Cookies.remove(EnterpriseList)
}

export function getSiteList() {
  return Cookies.getJSON(SiteList) || []
}

export function setSiteList(siteList) {
  return Cookies.set(SiteList, siteList)
}

export function removeSiteList() {
  return Cookies.remove(SiteList)
}

export function getCurrentEnterprise() {
  return Cookies.getJSON(CurrentEnterprise) || {}
}

export function setCurrentEnterprise(currentEnterprise) {
  return Cookies.set(CurrentEnterprise, currentEnterprise)
}

export function removeCurrentEnterprise() {
  return Cookies.remove(CurrentEnterprise)
}

export function getCurrentSite() {
  return Cookies.getJSON(CurrentSite) || {}
}

export function setCurrentSite(currentSite) {
  return Cookies.set(CurrentSite, currentSite)
}

export function removeCurrentSite() {
  return Cookies.remove(CurrentSite)
}

export function getUserInfo() {
  return Cookies.getJSON(UserKey) || {}
}

export function setUserInfo(userInfo) {
  return Cookies.set(UserKey, userInfo)
}

export function removeUserInfo() {
  return Cookies.remove(UserKey)
}
